#pragma once

#include "znx_http_base.h"
#include "znx_http_errno.h"
#include "znx_http_utils.h"
#include "znx_http_headers.h"
#include "comm/znx_array.h"
#include "comm/znx_handles.h"

typedef struct {
#if 0
    znx_array_t                             *arr;
#endif
    size_t                                  total_trailers;
    size_t                                  parse_trailers;
    znx_http_headers_t                      headers;               
} znx_http_trailers_t;


static inline znx_http_trailers_t *
znx_http_trailers_create(znx_pool_t *pool)
{
    znx_http_trailers_t *trailers;
    trailers = znx_pool_calloc(pool, sizeof(znx_http_trailers_t));
    znx_http_headers_init(&trailers->headers);
    return trailers;
}

znx_str_t znx_http_uri_ext(znx_str_t *uri);

znx_result_t znx_http_parse_header_line(znx_str_t *line, znx_http_header_t *header);

znx_result_t znx_http_parse_request_line(znx_http_request_t *request);

znx_result_t znx_http_parse_trailer_header(znx_pool_t *pool,
    znx_http_trailers_t *trailers, znx_str_t *value);

znx_result_t znx_http_parse_response_line(znx_http_request_t *request);